<center><h3>BOI 2001 Day 1 Problem 3</h3></center>

<p>
Mathematician Andris likes different puzzles and one of his favorites is covered box of mirrors.
If we look at the horizontal cross-section of such a box, we can see that its basement contains <i>n*m</i> square cells (<i>n</i> rows, and <i>m</i> columns).
In each cell there can be placed mirror which is oriented diagonally from lower left corner to upper right corner.
Both sides of the mirror reflect light.
<p>
At the box edges opposite to each cell row or column there is a gap through which you can light a beam into box or the beam can come out of the box.
Through each gap you can light the beam in only one direction--perpendicular to the edge containing the gap.
Therefore, beam reflecting from mirror changes its direction by 90 degrees.
When the beam goes through empty cells, its direction  doesn't change.
<p>
Gaps are numbered consecutively from 1 to <i>2*(n+m)</i>,  around the box, counter-clockwise, starting
from the gap on the left side of the upper left cell and going downwards.
Since arrangement of mirrors in the box is not visible,  the only way to determine it is by lighting
beams in some gaps and watching where light comes out.

<p>
<center><img src="image/5a.gif"></center>


<h2>Task</h2>
Write program that:
<ul>  
<li> reads the size of the box and gaps describing beams  coming in and out of the box from the input file <tt>box.in</tt>,  
<li> determines in which cells there are mirrors and which cells  are empty,   
<li> writes the result to the output file <tt>box.out</tt>.
</ul>
<p>
  If there are several possible solutions, your program should  output anyone of them.

<h2>Input</h2>
First line of input file <tt>box.in</tt> contains two positive  integers: <i>n</i> (the number of cells rows, <i>1&lt;=n&lt;=100</i>) and  <i>m</i> (the number of cells columns, <i>1&lt;=m&lt;=100</i>)  separated by a single space.
Each of the following <i>2*(n+m)</i> lines contains one  positive integer.
The number in the <i>i+1</i>-th line denotes the number of gap   from which light comes out if it is lightened into gap number <i>i</i>.

<h2>Output</h2>
Your program should write to the output file <tt>box.out</tt>  <i>n</i> lines, each of them containing <i>m</i> integers separated by  single spaces.
The <i>j</i>-th number in the <i>i</i>-th line should be 1, if there is  a mirror in the cell in the <i>i</i>-th row and <i>j</i>-th column of the  box, or it should be 0 if the cell is empty.

<h2>Sample Input</h2>
<pre>
2 3
9
7
10
8
6
5
2
4
1
3
</pre>

<h2>Sample Output</h2>
<pre>
0 1 0
0 1 1
</pre>

<p>
<center><img src="image/5b.gif">
